package com.javaweb.blogcite.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.javaweb.blogcite.pojo.Project;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ProjectMapper extends BaseMapper<Project> {
    //begion
    @Select("SELECT id, name, url, description, thumb, github, `order` FROM project")
    List<Project> listAllProject();

    @Update("UPDATE project SET name=#{name}, url=#{url}, description=#{description}," +
            " thumb=#{thumb}, github=#{github}, `order`=#{order} WHERE id=#{id}")
    int update(Project project);

    @Insert("INSERT INTO project(name, url, description, thumb, github, `order`) VALUES(#{name}, #{url}, #{description}, #{thumb}, #{github}, #{order})")
    int insert(Project project);

}
